# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Sören Tempel <soeren+alpine@soeren-tempel.net>
pkgname=openocd
pkgver=0.11.0
pkgrel=3
pkgdesc="Free and Open On-Chip Debugging, In-System Programming and Boundary-Scan Testing"
url="http://openocd.org/"
arch="all"
license="GPL-2.0-only,GPL-2.0-or-later,GPL-3.0-only"
makedepends="libftdi1-dev libusb-dev hidapi-dev jimtcl-dev libjaylink-dev
	automake autoconf libtool"
subpackages="$pkgname-dev $pkgname-doc"
source="https://downloads.sourceforge.net/project/openocd/openocd/$pkgver/openocd-$pkgver.tar.bz2
	fix-jimtcl-link.patch"

prepare() {
	default_prepare
	libtoolize -f
	aclocal
	automake --add-missing
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--disable-werror \
		--enable-cmsis-dap \
		--enable-sysfsgpio \
		--enable-bcm2835gpio \
		--disable-internal-jimtcl \
		--disable-internal-libjaylink
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="
4c8d880945083a05a3781b3fe2a39e4055df635faab1cacd78ca51ced75c9a478f4e16e6c6fa35ac117e2e4d6453cdd19818f1d27aae6edf1bda8c0e846d0de8  openocd-0.11.0.tar.bz2
6fd2fbe11917bb7f181ba67812f63e75d51bcd19e4df6a7e22e1abb8f36a4f4bdc9202e815f560476ec184d54d84df8ae4dceb17f2429b9dc1d9503804dacb03  fix-jimtcl-link.patch
"
